package com.koron.standard.jobStock.experiment.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.koron.standard.jobStock.experiment.bean.po.ExperimentItemParams;
import com.koron.standard.jobStock.experiment.mapper.ExperimentItemParamsMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 试验标准下工作项目-作业参数(ExperimentItemParams)表服务实现类
 *
 * @author jzp
 * @since 2021-09-16
 */
@Service
public class ExperimentItemParamsService extends ServiceImpl<ExperimentItemParamsMapper, ExperimentItemParams> {
    public void removeByExperimentId(String experimentId) {
        LambdaQueryWrapper<ExperimentItemParams> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(ExperimentItemParams::getExperimentId, experimentId);
        List<ExperimentItemParams> list = list(wrapper);
        removeByIds(list.stream().map(ExperimentItemParams::getId).collect(Collectors.toList()));
    }
}
